package org.zjx.strategy.impl;

import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.WinDef;
import org.zjx.action.Action;
import org.zjx.action.start.OpenWindowAction;
import org.zjx.action.start.ClickStartAction;
import org.zjx.core.IWindow;
import org.zjx.core.impl.StartWindow;
import org.zjx.strategy.IStrategy;

public class StartStrategy implements IStrategy {

    @Override
    public Action analyze(IWindow window) {
        if (window.getHwnd().equals(new WinDef.HWND(Pointer.NULL))) {
            return new OpenWindowAction(window);
        }
        return new ClickStartAction(window);
    }

    @Override
    public String getName() {
        return "启动策略";
    }

    @Override
    public int getPriority() {
        return 1;
    }

    @Override
    public boolean isApplicable(IWindow window) {
        return window instanceof StartWindow;
    }
}
